#ifndef CODEBLOCKS_APP_H
#define CODEBLOCKS_APP_H

#include <wx/wxprec.h>
#define DDE_SERVICE _T("/tmp/m_lock_%s.socket")
#define DDE_TOPIC _T("m_Code_DDEServer")
#include <wx/taskbar.h>
#include <wx/splash.h>
#include <wx/snglinst.h>
#include "manager.h"
#include "main.h"

class M_Code_SplashScreen;

class M_Code_App : public wxApp {
  public:
    virtual bool OnInit();
    virtual int OnExit();
    virtual int OnRun();
    wxString GetAppPath() const;
    int ParseCmdLine( MainFrame* handlerFrame, const wxString& CmdLine = wxEmptyString );
    void OnAppActivate( wxActivateEvent& event );
    bool OnCmdLineParsed( wxCmdLineParser& parser );
    void OnFatalException();
    void LoadDelayedFiles( MainFrame* frame );
    void SetAutoFile( wxString& file );
    void AddFileToOpenDelayed( const wxString& filename );
  protected:
    void OnBatchBuildDone( CodeBlocksEvent& event );
    void OnTBIconLeftDown( wxTaskBarIconEvent& event );
    bool LoadConfig();
    void InitDebugConsole();
    void InitExceptionHandler();
    MainFrame* InitFrame();
    int BatchJob();
    wxLocale m_locale;
    wxArrayString m_DelayedFilesToOpen;
  private:
    void SetupPersonality( const wxString& personality );
    wxString m_Prefix, m_UserDataDir, m_BatchTarget, m_Script, m_AutoFile;
    wxScrollingDialog* m_pBatchBuildDialog;
    MainFrame* m_Frame;
    wxSingleInstanceChecker* m_pSingleInstance;
    bool m_Batch, m_BatchNotify, m_BatchWindowAutoClose, m_Build, m_ReBuild, m_Clean, m_HasProject, m_HasWorkSpace, m_HasDebugLog,
         m_CrashHandler, m_SafeMode, m_DDE;
    int m_BatchExitCode;
    DECLARE_EVENT_TABLE()
};

DECLARE_APP( M_Code_App );

#endif
